Skip to main content

Proxmox Config Backup

· 2 min read

Automating Proxmox Config Backup with Systemd and Synology Active Backup

After reading this insightful thread on the Proxmox forum: Backup Cluster Config (pmxcfs /etc/pve), I was inspired to create an automated backup solution for my Proxmox configuration.

I decided to implement a systemd script that automates the backup of the Proxmox sqlite database that contains the cluster configuration.
Here is the script I came up with:

[Unit]
Description=Backup sqlite database of Proxmox

[Service]
Type=oneshot
ExecStart=/bin/bash -c "/usr/bin/sqlite3 /var/lib/pve-cluster/config.db .dump > /backup/config.dump.$(date --utc +%Y%m%d%H%M%S).sql"

# ExecStartPost runs after ExecStart, and this will remove older backups, keeping only the 35 most recent ones.
ExecStartPost=/bin/bash -c "ls -tp /backup/config.dump.*.sql | grep -v '/$' | tail -n +36 | xargs -I {} rm -- {}"

The script creates an automated dump of the Proxmox cluster config, ensuring I have regular backups and a retention policy that only keeps the latest 35 backups. You can find more details on this script and its implementation on my Wiki page.

Integrating Synology Active Backup

To further enhance my backup strategy, I configured a Synology Active Backup task to automatically back up the /backup directory to my NAS. This task runs every week, ensuring that I always have an offsite copy of my cluster configuration in case of emergencies. This extra layer of protection gives me peace of mind knowing that I can easily restore my configuration whenever necessary.

By combining systemd automation and Synology Active Backup, I have a reliable backup system in place to safeguard my Proxmox configurations.